-
Notifications
You must be signed in to change notification settings - Fork 50
GH-20: Expose bw, cr, sf controls and CRC checks #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GH-20: Expose bw, cr, sf controls and CRC checks #21
Conversation
hiya! thanks - would some of these would be better as 'property' types, rather than init arguments. that way people can adjust the factors depending on use cases? |
I'd also thought of exposing them as properties though what I've seen in practice is that attempting to modify values of some of these, say rssi, after using the radio can cause an indefinite hang. That behavior exists when using the current implementation's rssi property. At the moment, I am unsure of how to fix this for rssi and so was hesitant to add similar complications with more properties that can be changed immediately after instantiation but not after using the radio to send/receive. I sure like the idea though. |
We could go ahead and move these input parameters to each be a property, if you think that would make for a better api... and then hope we can come back to figure out how to avoid the hang I described on the rssi property (and these new ones)? |
i think lets do properties, at worst you can just set them before you begin the radio, and if we fix the bug you'll be able to adjust them whenever! |
Cool -- I'll make the change and then update my code that uses it to test. |
Apologies, earlier I said I'd modified |
The changes to expose as property appear to be working happily with my existing (now updated) code. Playing around in the interactive shell, it also appears to do what I hoped. Here,
Likewise,
I have yet to experiment with which settings can be safely altered after the radio has been used. The above was all done before transmitting anything. Hopefully the radio just needs to be put back into an appropriate mode to permit changing |
i'm diggin' it! |
Looks great. I will run some tests with it tomorrow. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ran some tests to verify that this PR "does no harm" and it seems to work fine with my existing code.
The changes look great. There are a lot of features to experiment with and test, but since it does not break any existing code, I am happy to see it merged so more folks can use it.
Thank your for submitting this!
BTW -- I did test both with CP (ItsyBity_M4 and RFM9x breakout) -- and on a Raspberry Pi with breakout and bonnet.
thanks! @brentru check this still works with your examples you've done for the RFM9x? |
@ladyada Missed this tag - I'll test this against the RFM9x Bonnet Code, examples I've written for learn, and CircuitPython_TinyLoRa first-thing tomorrow when I have access to that hardware and review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@applio Looks good, approved! Changes are compatible and non-breaking when used with Adafruit_CircuitPython_TinyLoRa (tested a few different modes/settings to exercise it).
Updating https://github.com/adafruit/Adafruit_CircuitPython_MLX90393 to 1.2.0 from 1.1.3: > Merge pull request adafruit/Adafruit_CircuitPython_MLX90393#6 from microbuilder/master > Separated raw and processed data > Merge pull request adafruit/Adafruit_CircuitPython_MLX90393#5 from microbuilder/master Updating https://github.com/adafruit/Adafruit_CircuitPython_NeoPixel to 3.3.6 from 3.3.5: > Merge pull request adafruit/Adafruit_CircuitPython_NeoPixel#40 from cpforbes/cpf-list-fix Updating https://github.com/adafruit/Adafruit_CircuitPython_PN532 to 2.0.4 from 2.0.3: > Merge pull request adafruit/Adafruit_CircuitPython_PN532#18 from jerryneedell/jerryn_ntag203 > Merge pull request adafruit/Adafruit_CircuitPython_PN532#16 from Tasm-Devil/master Updating https://github.com/adafruit/Adafruit_CircuitPython_RFM9x to 1.1.5 from 1.1.4: > Merge pull request adafruit/Adafruit_CircuitPython_RFM9x#21 from applio/enh_expose_Bw_Cr_Sf_controls > Merge pull request adafruit/Adafruit_CircuitPython_RFM9x#19 from applio/fix_broken_CoC_link_tweaks Updating https://github.com/adafruit/Adafruit_CircuitPython_Bitmap_Font to 1.0.2 from 1.0.1: > Merge pull request adafruit/Adafruit_CircuitPython_Bitmap_Font#8 from tannewt/fontio Updating https://github.com/adafruit/Adafruit_CircuitPython_HID to 3.3.3 from 3.3.2: > Merge pull request adafruit/Adafruit_CircuitPython_HID#31 from dhalbert/gamepad-struct-format-fix
This patch proposes the following enhancements without breaking existing user code or any default behaviors:
RFM9x.__init__
a keyword input parameter,signal_bandwidth
RFM9x.__init__
a keyword input parameter,coding_rate
RFM9x.__init__
a keyword input parameter,spreading_factor
RFM9x.__init__
a keyword input parameter,enable_crc
The defaults remain a match for RadioHead Bw125Cr45Sf128 mode with CRC checking off.
This patch has been used successfully with Adafruit RFM95W. It has also successfully enabled communications between the Adafruit RFM95W and the TTGO LORA32 (an ESP32 board with a different RFM95 radio) at a variety of different settings, having verified that it really was communicating at those different bandwidths, etc.
This code was made possible through careful study of the code used in https://github.com/MZachmann/LightLora_Arduino to expose these same features. Credit goes to Mark Zachmann for having done the truly hard work of figuring out exactly how to tickle the registers in the hardware.
The adafruit/Adafruit_CircuitPython_RFM9x library is an excellent library and it feels intuitive when using it. Thank you for creating it and sharing it with others. I hope these enhancements can expand its reach.
This suggested patch was mentioned in issue GH-20.
Notably, this patch includes changes made in another pull request (GH-19).